#pragma once

#include <vector>
#include "VertexDeclaration.h"

class IVertexContainer
{
public:
	inline IVertexContainer( const VertexDeclaration& declaration ) : m_declaration(declaration), m_IBO(false), m_VBO(false), m_IBOID(0), m_VBOID(0)
	{
	};
	inline const VertexDeclaration& getVertexDeclaration() const
	{
		return m_declaration;
	};
	void resize( unsigned int count )
	{
		m_vertices.resize(count * m_declaration.m_vertexSize);
	};
	unsigned int* getAttributeIndex() const
	{
		return (unsigned int*)&(m_attributes[0]);
	};
	std::vector<unsigned int>& AttributeIndex()
	{
		return m_attributes;
	};
	std::vector<unsigned short>& getIndices()
	{
		return m_indices;
	};
	unsigned int getVerticeCount() const
	{
		return m_vertices.size()/m_declaration.m_vertexSize;
	};
	unsigned int getIndiceCount() const
	{
		return m_indices.size();
	};
	bool IsVBO() const
	{
		return m_VBO;
	};
	unsigned int getVBOID() const
	{
		return m_VBOID;
	};
	bool IsIBO() const
	{
		return m_IBO;
	};
	unsigned int getIBOID() const
	{
		return m_IBOID;
	};
	void* getVertexPointer() const
	{
		return (void*)&(m_vertices[0]);
	};
	void* getIndexPointer() const
	{
		return (void*)&(m_indices[0]);
	};
protected:
	VertexDeclaration m_declaration;
	std::vector<unsigned int> m_attributes;
	bool m_IBO;
	bool m_VBO;
	unsigned int m_IBOID;
	unsigned int m_VBOID;
	std::vector<unsigned char> m_vertices;
	std::vector<unsigned short> m_indices;
};

template<class T>
class VertexContainer : public IVertexContainer
{
public:
	VertexContainer( const VertexDeclaration& declaration ) : IVertexContainer(declaration)
	{	
	}

	inline T* getVertices()
	{
		return (T*)&(m_vertices[0]);
	};
private:
};